from tkinter import *
from tkinter import ttk
import random

class App(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        
        self.isAnswer = False
        self.vv = StringVar()
        self.vv.set('开始')
        self.bt = ttk.Label(self, font='方正胖娃_GBK 100', textvariable=self.vv)
        self.bt.pack()
        self.bt.bind('<ButtonPress>', self.onclick)

    def onclick(self, event):
        if self.isAnswer == False:
            self.a = self.get_number()
            self.b = self.get_number()
            self.vv.set(str(self.a) + '×' + str(self.b))
            self.isAnswer = True
        else:
            self.vv.set(str(self.a*self.b))
            self.isAnswer = False

    def get_number(self):
        while True:
            a = random.randint(10,99)
            if a % 10 != 0:
                return a

app = App()
app.master.title('计算训练')
app.master.geometry('600x200')
app.mainloop()
